package API.DAY5.io;

import java.io.FileOutputStream;
import java.io.IOException;
import java.io.ObjectOutputStream;

//对象流，作用是序列化与反序列化
public class OosDemo {
    public static void main(String[] args) throws IOException {
        String name = "毛丢丢";
        int age = 21;
        String gender = "女";
        String[] otherInfo = {"古籍修复","记忆力很好","写小说"};
        Person person = new Person(name,age,gender,otherInfo);

        FileOutputStream fos = new FileOutputStream("person.obj");
        ObjectOutputStream oos = new ObjectOutputStream(fos);

        oos.writeObject(person);
        System.out.println("序列化成功");
        oos.close();
    }
}
